package com.xinqi.modules.prepare.notice.controller.inner;

import com.xinqi.common.base.response.PageInfo;
import com.xinqi.common.base.response.Param;
import com.xinqi.common.base.response.R;
import com.xinqi.modules.prepare.notice.dto.req.PrepareNoticeQueryDTO;
import com.xinqi.modules.prepare.notice.dto.rsp.PrepareNoticeResultDTO;
import com.xinqi.modules.prepare.notice.service.PrepareNoticeService;
import io.swagger.v3.oas.annotations.Hidden;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 备课区公告内部控制层
 *
 * @author: system
 * @date: 2023/03/19
 */
@Hidden
@RestController
@RequestMapping("/inner/prepare-notice")
@RequiredArgsConstructor
public class PrepareNoticeInnerController {
    private final PrepareNoticeService prepareNoticeService;

    /**
     * 备课区公告-分页
     */
    @GetMapping("/page")
    public R<PageInfo<PrepareNoticeResultDTO>> page(Param pageable, PrepareNoticeQueryDTO dto) {
        PageInfo<PrepareNoticeResultDTO> page = prepareNoticeService.page(pageable, dto);
        return R.data(page);
    }

    /**
     * 备课区公告-详情
     */
    @GetMapping("/{id}")
    public R<PrepareNoticeResultDTO> findById(@PathVariable("id") Long id) {
        PrepareNoticeResultDTO dto = prepareNoticeService.findById(id);
        return R.data(dto);
    }
}
